export default {
  async onShareAppMessage() {
    //发送给朋友
    const share = this.$store.state.share.uuidName
    const userId = this.$store.state.auth.userInfo
    console.log('来到这里触发了吗', userId, share)
    uni.showLoading({
      title: '转发中...',
      mask: true,
    })
    await this.$store.dispatch('IchatShareNew')
    // await sleep()
    uni.hideLoading()
    if (!userId.user_id) {
      uni.showToast({
        title: '网络错误',
        icon: 'none',
      })
      return Promise.reject(false)
    }
    if (!share.uuid) {
      return {
        path: `/pages/home/home?invite=${userId.user_id}`,
        title: '道测AI小助手',
      }
    }
    return {
      path: `/pages/share/index?invite=${userId.user_id}&uuid=${share.uuid}`,
      title: share.name,
    }
  },
  onShareTimeline() {
    //分享到朋友圈
    const share = this.$store.state.config.setting
    return {
      imageUrl: share.share_img,
      path: '/pages/home/home?id=' + this.$store.state.auth.userInfo.id || '',
      title: share.share_title,
    }
  },
}
